<template>
  <div class="health-contianer">
    <div class="health-list">
      <div class="health-item" @click="selectHealth(item.id)" v-for="item in healthList" :key="item.id">
        <div class="health-name-container">
          <div class="health-name">{{item.name}}</div>
          <div class="health-detail">包含{{item.itemNumber}}项检查</div>
        </div>
        <div class="price">¥{{item.price}}</div>
      </div>
      <!-- <div class="health-item" @click="selectHealth(7)">
        <div class="health-name-container">
          <div class="health-name">12312</div>
          <div class="health-detail">包123项检查</div>
        </div>
        <div class="price">¥123</div>
      </div> -->
    </div>
    <router-view></router-view>
    <!-- <div style="height: 44px"/> -->
  </div>
</template>

<script>
import { getHealthList } from 'api/main'

export default {

  data () {
    return {
      healthList: []
    }
  },
  created() {
    this._getHealthList()
  },
  methods : {
    selectHealth(healthId) {
      this.$router.push({
        path: `/healthList/${healthId}`
      })
    },
    _getHealthList() {
      getHealthList().then((res) => {
        this.healthList = res
      })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped scoped lang="stylus" rel="stylesheet/stylus">
  @import "healthList.styl"
</style>
